﻿using System.Collections.Generic;

namespace MsTestUtilities.SolutionAnalysis
{
    public class ItemGroupClassifier
    {
        private CsProject project;

        public ItemGroupCollection ItemGroups { get; private set; }
        
        public ItemGroupClassifier(CsProject project)
        {
            this.project = project;
            ItemGroups = new ItemGroupCollection();
        }

        public void Add(Item item)
        {
            switch (item.Name)
            {
                case "ProjectReference":
                    var projectReference = new ProjectReference(project, item);
                    ItemGroups.ProjectReference.Add(projectReference);
                    break;
                case "Reference":
                    var reference = new Reference(project, item);
                    ItemGroups.Reference.Add(reference);
                    break;
                case "Content":
                    var content = new ContentFile(project, item);
                    ItemGroups.Content.Add(content);
                    break;
                default:
                    ItemGroups.Unknown.Add(item);
                    break;
            }
        }

        public void AddRange(IList<Item> items)
        {
            foreach(var item in items)
            {
                Add(item);
            }
        }

        private void CreateSpecificItem(Item item)
        {
            
        }
    }
}
